# select_yaml.py
import os
import shutil
from tkinter import messagebox

def copy_yaml_to_destination(yaml_file_path, destination_folder):
    if not os.path.exists(destination_folder):
        messagebox.showwarning("警告", f"目标文件夹 '{destination_folder}' 不存在！")
        return

    # 复制 YAML 文件到目标文件夹
    try:
        shutil.copy2(yaml_file_path, destination_folder)
        messagebox.showinfo("成功", f"YAML 文件已成功复制到: {destination_folder}")
        print(f"YAML 文件 '{yaml_file_path}' 已成功复制到 '{destination_folder}'")
    except Exception as e:
        messagebox.showerror("错误", f"复制 YAML 文件时出错: {str(e)}")